import request from '@/config/axios'
import type { Dayjs } from 'dayjs'

/** 班级一周大事信息 */
export interface ClassEvent {
  id: number // 编号
  classId?: number // 班级ID
  weekDateStart?: string | Dayjs // 周起始日期
  content?: string // 一周大事
}

// 班级一周大事 API
export const ClassEventApi = {
  // 查询班级一周大事分页
  getClassEventPage: async (params: any) => {
    return await request.get({ url: `/school/class-event/page`, params })
  },

  // 查询班级一周大事详情
  getClassEvent: async (params: any) => {
    return await request.get({ url: `/school/class-event/query`, params })
  },

  // 新增班级一周大事
  createClassEvent: async (data: ClassEvent) => {
    return await request.post({ url: `/school/class-event/create`, data })
  },

  // 修改班级一周大事
  updateClassEvent: async (data: ClassEvent) => {
    return await request.put({ url: `/school/class-event/update`, data })
  },

  // 删除班级一周大事
  deleteClassEvent: async (id: number) => {
    return await request.delete({ url: `/school/class-event/delete?id=` + id })
  },

  /** 批量删除班级一周大事 */
  deleteClassEventList: async (ids: number[]) => {
    return await request.delete({ url: `/school/class-event/delete-list?ids=${ids.join(',')}` })
  },

  // 导出班级一周大事 Excel
  exportClassEvent: async (params) => {
    return await request.download({ url: `/school/class-event/export-excel`, params })
  }
}
